package gagak.framework.web.paramresovler.converter;


import gagak.framework.web.support.http.MediaType;
import gagak.framework.web.exception.HttpMediaTypeNotAcceptableException;
import gagak.framework.web.support.request.NativeWebRequest;

import java.util.Collections;
import java.util.List;


public interface ContentNegotiationStrategy {

    /*
     * A singleton list with {@link MediaType#ALL} that is returned from
     * {@link #resolveMediaTypes} when no specific media types are requested.
     *
     * @since 5.0.5
     */
    List<MediaType> MEDIA_TYPE_ALL_LIST = Collections.singletonList(MediaType.ALL);


    /*
     * 将给定的请求解析为媒体类型列表
     * 返回的 List 首先按照 specificity 参数排序，其次按照 quality 参数排序
     * 如果请求的媒体类型不能被解析则抛出 HttpMediaTypeNotAcceptableException 异常
     */
    List<MediaType> resolveMediaTypes(NativeWebRequest webRequest)
            throws HttpMediaTypeNotAcceptableException;

}
